#!/bin/bash

HomeDir=/home/production

#先判断是否存在某个文件构建配置文件
if  [ -e $HomeDir/cron_true.txt ]; then

rm -rf $HomeDir/chat-server/.env
cp $HomeDir/chat-server/env.prod.cron.true $HomeDir/chat-server/.env

else

rm -rf $HomeDir/chat-server/.env
cp $HomeDir/chat-server/env.prod.cron.false $HomeDir/chat-server/.env

fi

#杀死进程并重启进程
sudo lsof -i:9501|grep -v PID|awk '{print $2}'|sudo xargs kill -9
sudo lsof -i:9502|grep -v PID|awk '{print $2}'|sudo xargs kill -9

echo 'kill success';
